package cn.bnuz.edu.liyang.wait_eat_what;

import android.os.Bundle;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;


import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //长按美食文本弹出菜单
        textView = (TextView) findViewById((R.id.thereT1));
        registerForContextMenu(textView);

    }
    //长按美食文本弹出菜单
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo){
        MenuInflater menuInflater = new MenuInflater((this));
        menuInflater.inflate(R.menu.menu,menu);

    }
    //长按美食文本弹出菜单
    @Override
    public boolean onContextItemSelected(MenuItem item){
        switch (item.getItemId()){
            case R.id.menu_copy:
                Toast.makeText(MainActivity.this,R.string.copy_next,Toast.LENGTH_SHORT).show();
                break;
        }
        return true;
    }

//    //界面跳转按钮监听器
//    View.OnClickListener l =new View.OnClickListener() {
//        @Override
//        public void onClick(View view) {
//            FragmentManager fm = getFragmentManager();
//            FragmentTransaction ft = fm.beginTransaction();
//            Fragment f = null;
//            switch (view.getId()){
//                case R.id.loginbuttom:
//                    f = new Login_Fragment();
//                    break;
//                default:
//                    break;
//            }
//
//            ft.replace(R.id.fragment,f);
//            ft.commit();
//        }
//    };



}